package com.fan.txl.mock.api.service.mock;

import com.fan.txl.mock.api.annotation.MockRsp;
import com.fan.txl.mock.api.service.RpcService;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.mock.BehaviorDelegate;

/**
 * Created by os on 2017/4/2.
 * Title
 */
@SuppressWarnings("unused")
public class MockRpcService extends MockService<RpcService> implements RpcService {

    public MockRpcService(BehaviorDelegate<RpcService> delegate) {
        super(delegate);
    }

    @MockRsp(path = "mock/com.xgggh.srv.oauth2/Oauth2.Token.json")
    @Override
    public Observable<String> rpc(@Field("method") String method, @Field("service") String service, @Field("request") String request) {
        String rsp="";
        //token mock
        //if (method==AuthService.methodToken && service==AuthService.service){
            rsp= mock(service,method);
        //}
        return delegate.returningResponse(rsp).rpc(method,service,request);
    }
}
